package com.jiazhong.basic.pack0308.coll;

import java.util.Vector;

// 特殊数据类型(自定义数据类型)存放到容器(集合)中
public class DemoC {

    public static void a(){
        Vector<Student> vector = new Vector<>();
        Student s1 = new Student(1,"张三1",'男',23,"陕西西安");
        Student s2 = new Student(2,"张三2",'女',34,"陕西宝鸡");
        Student s3 = new Student(3,"张三3",'男',21,"陕西渭南");
        Student s4 = new Student(4,"张三4",'女',25,"陕西汉中");
        Student s5 = new Student(1,"张三1",'男',23,"陕西西安");
        vector.add(s1);
        vector.add(s2);
        vector.add(s3);
        vector.add(s4);
        vector.add(s5);
        System.out.println(vector);
    }
    // 复杂类型的查找
    private static void b(){
        Vector<Student> vector = new Vector<>();
        Student s1 = new Student(1,"张三1",'男',23,"陕西西安");
        Student s2 = new Student(2,"张三2",'女',34,"陕西宝鸡");
        Student s3 = new Student(3,"张三3",'男',21,"陕西渭南");
        Student s4 = new Student(4,"张三4",'女',25,"陕西汉中");
        Student s5 = new Student(1,"张三6",'女',21,"湖北武汉");
        vector.add(s1);
        vector.add(s2);
        vector.add(s3);
        vector.add(s4);
        System.out.println(s1==s5);
        System.out.println(s1.equals(s5));
        boolean b = vector.contains(s5);
        System.out.println(b);

    }

    public static void main(String[] args) {
        b();
    }

}
